/**
* Copyright 2009, Jethro Grassie, Creative Jar Technology Ltd (http://www.cjtech.co.uk)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
**/

package com.cjt.rmi.client;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import com.cjt.rmi.common.ITimeUtil;

public class TimeUtilClient
{
    public static void main(String args[])
    {
        if(System.getSecurityManager() == null)
        {
            System.setSecurityManager(new SecurityManager());
        }
        try
        {
            String name = "TimeUtil";
            Registry registry = LocateRegistry.getRegistry(args[0]);
            for(int i=0; i < registry.list().length; i++)
                System.out.println(registry.list()[i]);
            ITimeUtil util = (ITimeUtil) registry.lookup(name);
            System.out.println(util.getTime());
        }
        catch(Exception e)
        {
            System.err.println("TimeUtilClient exception:");
            e.printStackTrace();
        }
    }    
}

